 
package com.edu.hre.common.cache;

import java.io.Serializable;
import java.util.Calendar;
 
class CachedItem implements Serializable{

	private long lastUpdatedTime = 0;
	private Object item = null;
	private long timeToLive = 5*60*1000; // default 5 minutes
	
	/**
	 * 
	 * @param _item
	 * @param _lastUpdatedTime
	 */
	public CachedItem(Object _item,  long timeToLive, long _lastUpdatedTime) {
		item = _item;
		lastUpdatedTime = _lastUpdatedTime;
		this.timeToLive = timeToLive;
	}
	
	public CachedItem(Object _item, long _lastUpdatedTime) {
		item = _item;
		lastUpdatedTime = _lastUpdatedTime;
	}
	
	
	public CachedItem(Object _item) {
		this(_item, Calendar.getInstance().getTime().getTime());
	}

	
	
	public long getTimeToLive() {
		return timeToLive;
	} 
	

	public void setTimeToLive(long timeToLive) {
		this.timeToLive = timeToLive;
	} 
 
	
	public Object getItem() {
		return item;
	}

	/**
	 * @return
	 */
	public long getLastUpdatedTime() {
		return lastUpdatedTime;
	}

	/**
	 * @param object
	 */
	public void setItem(Object object) {
		item = object;
	}

	/**
	 * @param date
	 */
	public void setLastUpdatedTime(long date) {
		lastUpdatedTime = date;
	}

}
